package request

import (
	"encoding/json"
)

type RequestParams struct {
	Method string      `json:"method"`
	Data   interface{} `json:"data"`
}

func ShouldBindData(params interface{}, obj interface{}) error {
	paramsJson, err := json.Marshal(params)
	if err != nil {
		return err
	}

	err = json.Unmarshal(paramsJson, &obj)
	if err != nil {
		return err
	}

	return nil
}
